package com.cskaoyan.controller;

import com.cskaoyan.bean.bo.WxCollectAddorDeleteBO;
import com.cskaoyan.bean.common.BaseRespVo;
import com.cskaoyan.bean.common.CommonData;
import com.cskaoyan.service.WxCollectService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author wei
 * @since 2022/09/08 14:42
 */
@RestController
@RequestMapping("wx/collect")
public class WxCollectController {
    @Autowired
    WxCollectService wxCollectService;

    //    Request URL: http://182.92.235.201:8083/wx/collect/list?type=0&page=1&limit=10
//Request Method: GET
//Status Code: 200
    @GetMapping("list")
    public BaseRespVo collectList(Byte type, int page, int limit) {
        CommonData commonData = wxCollectService.queryCollectList(type, page, limit);
        BaseRespVo<Object> baseRespVo = new BaseRespVo<>();
        baseRespVo.setErrno(0);
        baseRespVo.setErrmsg("成功");
        baseRespVo.setData(commonData);
        return baseRespVo;
    }

    //Request URL: http://182.92.235.201:8083/wx/collect/addordelete
    //Request Method: POST
    //Status Code: 200
    //    {type: 0, valueId: 1181027}



    @PostMapping("addordelete")
    public BaseRespVo collectAddorDelete(@RequestBody WxCollectAddorDeleteBO wxCollectAddorDeleteBO) {
        wxCollectService.addordelete(wxCollectAddorDeleteBO);
        return BaseRespVo.ok();
    }
}

